﻿<Window x:Class="SoftTeach.View.Curricula.CurriculumZuweisenDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:resources="clr-namespace:SoftTeach.Resources"
        xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
        xmlns:curricula="clr-namespace:SoftTeach.ViewModel.Curricula"
        xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
        xmlns:controls="clr-namespace:SoftTeach.Resources.Controls" mc:Ignorable="d" 
             d:DesignHeight="465" d:DesignWidth="741" SizeToContent="WidthAndHeight"
        Icon="/SoftTeach;component/Images/Curriculum32.png">
  <Window.Resources>
    <CollectionViewSource x:Key="GroupedAvailableSequenzenViewSource" Source="{Binding AvailableSequenzenDesCurriculums}">
      <CollectionViewSource.GroupDescriptions>
        <PropertyGroupDescription PropertyName="SequenzModul"/>
      </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>
    <CollectionViewSource x:Key="GroupedTagespläneundSequenzenViewSource" Source="{Binding TagespläneAndSequenzenCollection}">
      <CollectionViewSource.SortDescriptions>
        <scm:SortDescription PropertyName="ViewModelType" Direction="Ascending" />
        <scm:SortDescription PropertyName="TagesplanDatum" Direction="Ascending" />
        <scm:SortDescription PropertyName="AbfolgeIndex" Direction="Ascending" />
      </CollectionViewSource.SortDescriptions>
      <CollectionViewSource.GroupDescriptions>
        <PropertyGroupDescription PropertyName="ViewModelType"/>
        <PropertyGroupDescription PropertyName="TagesplanMonat"/>
        <!--<PropertyGroupDescription PropertyName="SequenzModul"/>-->
      </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>
    <curricula:CurriculumAdaptViewDataTemplateSelector x:Key="CurriculumAdaptViewDataTemplateSelector"/>
  </Window.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition/>
      <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <controls:SmallDialogHeader Grid.Row="0" Title="Passen Sie hier das Curriculum so an, dass es in den Jahresplan passt"
                                      Icon="/SoftTeach;component/Images/Curriculum32.png"/>
    <Grid Grid.Row="1">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" MinHeight="100"/>
        <RowDefinition Height="3"/>
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <HeaderedContentControl Grid.Row="0" Header="Jahresplan" Margin="5">
        <ListBox ItemsSource="{Binding Source={StaticResource GroupedTagespläneundSequenzenViewSource}}" 
                ItemTemplateSelector="{StaticResource CurriculumAdaptViewDataTemplateSelector}" 
                 ItemContainerStyle="{StaticResource NoBorderListBoxItemStyle}"
                dd:DragDrop.IsDragSource="True" 
                  dd:DragDrop.IsDropTarget="True"
                  dd:DragDrop.DropHandler="{Binding}"
                  dd:DragDrop.DragAdornerTemplate="{StaticResource SequenzDragAdorner}"
                  Name="CurriculumItemsListBox"
                  BorderThickness="0"
                  MinHeight="120">
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <StackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
          <ListBox.GroupStyle>
            <GroupStyle ContainerStyle="{StaticResource GroupHeaderStyleBoth}">
              <GroupStyle.Panel>
                <ItemsPanelTemplate>
                  <StackPanel/>
                </ItemsPanelTemplate>
              </GroupStyle.Panel>
            </GroupStyle>
            <GroupStyle ContainerStyle="{StaticResource GroupHeaderStyleBoth}">
              <GroupStyle.Panel>
                <ItemsPanelTemplate>
                  <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
              </GroupStyle.Panel>
            </GroupStyle>
          </ListBox.GroupStyle>

        </ListBox>
      </HeaderedContentControl>
      <Line Grid.Row="1" Fill="{StaticResource DefaultButtonsBackgroundBrush}"/>
      <HeaderedContentControl Grid.Row="2" Header="Verfügbare Module" Margin="5">
        <ListBox ItemsSource="{Binding Source={StaticResource GroupedAvailableSequenzenViewSource}}" 
                  ItemTemplate="{StaticResource SequenzenGroupView}" 
                  dd:DragDrop.IsDragSource="True" 
                  dd:DragDrop.IsDropTarget="True"
                  dd:DragDrop.DropHandler="{Binding}"
                  dd:DragDrop.DragAdornerTemplate="{StaticResource SequenzDragAdorner}"
                  Name="AvailableItemsListBox"
                  BorderThickness="0"
                  MinHeight="120">
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <StackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
          <ListBox.GroupStyle>
            <GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
              <GroupStyle.Panel>
                <ItemsPanelTemplate>
                  <StackPanel/>
                </ItemsPanelTemplate>
              </GroupStyle.Panel>
            </GroupStyle>
          </ListBox.GroupStyle>
        </ListBox>
      </HeaderedContentControl>
    </Grid>
    <Grid Background="{StaticResource DefaultButtonsBackgroundBrush}" Grid.Row="2">
      <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="10">
        <Button Command="{Binding Path=UpdateHalbjahresplanWithCurriculumCommand}" 
                ToolTip="Jahresplan der Klasse mit Vorgaben aus diesem Curriculum aktualisieren.">Jahresplan aktualisieren
        </Button>
        <Rectangle Width="30"/>
        <Button Width="100" HorizontalAlignment="Right" IsDefault="True" Click="OkClick" TabIndex="2">Fertig</Button>
      </StackPanel>
    </Grid>
  </Grid>
</Window>

